home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3007 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.lpr.carel.fi!usenet
  2. From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: (no subject)
  5. Date: Thu, 25 Jan 1996 14:01:16 +0200
  6. Organization: Carelcomp Forest
  7. Message-ID: <3107710C.B26@cmt.lpr.mail.carel.fi>
  8. References: <4e71v9$iqb@dingo.cc.uq.oz.au>
  9. NNTP-Posting-Host: renoir.cclahti.carel.fi
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b6a (WinNT; I)
  14.  
  15. coonsta@peg.apc.org wrote:
  16. > Here is the structure and relevant buffer, which contains the data I want
  17. > to extract (ultimately, I want plain ints):
  18. > typedef struct pcx_picture_typ
  19. > {
  20. >         pcx_header header;          //Forget it: it's irrelevant
  21. >         RGB_color pallette[256];    //Forget this too.
  22. >         char far *buffer;           //That's the one.
  23. > } pcx_picture, *pcx_picture_pointer;
  24. > [snip]
  25. > Anywho... say I have an integer called x, and I want the data in
  26. > buffer[32000], what would I do?  E.G.
  27. > void main(void)
  28. > {
  29. >         int x;
  30. >         pcx_picture thepicture;
  31. >         .    (The buffer is initialised and filled with data from a file
  32. >         .    in here).
  33. >         .
  34. >         x = thepicture.buffer[32000];   // doesn't seem to work.
  35. > }
  36.  
  37. Try using
  38.  
  39.     x = (int *)&thepicture.buffer[32000];
  40. or
  41.     x = (int *)(thepicture.buffer + 32000);
  42.  
  43. Later,
  44. AriL
  45.  
  46. -- 
  47. All my opinions are mine and mine alone.
  48.